import { createRouter, createWebHistory } from 'vue-router'
import { ArticlePath } from '@/models/@types'

const routes = [
  {
    path: '/',
    name: 'Home',
    component: () => import('../views/Home.vue')
  },
  {
    path: ArticlePath.Path +':articleId',
    name: 'Articles',
    component: () => import('../views/Article.vue')
  },
  {
    path: '/talks',
    name: 'talkList',
    meta: {
      title: "壹句话",
    },
    component: () => import('../views/TalkList.vue')
  },
  {
    path: '/talks/:talkId',
    name: 'talks',
    component: () => import('../views/Talk.vue')
  },
  {
    path: '/archives',
    name: 'Archives',
    meta: {
      title: "归档",
    },
    component: () => import('../views/Archives.vue')
  },
  {
    path: ArticlePath.TAG_PATH,
    name: 'ArticleList',
    component: () => import('../views/ArticleList.vue')
  },
  {
    path: '/tags',
    name: 'Tags',
    meta: {
      title: "文章标签",
    },
    component: () => import('../views/Tags.vue')
  },
  {
    path: '/about',
    name: 'About',
    meta: {
      title: "关于作者",
    },
    component: () => import('../views/About.vue')
  },
  {
    path: '/message',
    name: 'Message',
    meta: {
      title: "众言",
    },
    component: () => import('../views/Message.vue')
  },
  {
    path: '/friends',
    name: 'Friends',
    meta: {
      title: "众星",
    },
    component: () => import('../views/FriendLink.vue')
  },
  {
    path: '/books',
    name: 'Book',
    meta: {
      title: "一些阅读",
    },
    component: () =>import('../views/Book.vue')
  },
  {
    meta: {
      title: "相册详情",
    },
    path: '/photos/:albumId',
    name: 'Photos',
    component: () => import('../views/PhotoInfo.vue')
  },
  {
    meta: {
      title: "壹些风景",
    },
    path: '/photos',
    name: 'PhotoAlbum',
    component: () => import('../views/PhotoAlbum.vue')
  },
  {
    path: '/404',
    name: '404',
    meta: {
      title: "出错啦",
    },
    component: () => import('../views/404.vue')
  },
  {
    path: '/oauth/login/qq',
    name: 'qqLogin',
    component: () => import('../components/OauthLogin.vue')
  },
  {
    path: '/:catchAll(.*)',
    redirect: '/404',
    hidden: true
  },
  {
    path: '/agreement',
    name: 'Agreement',
    meta: {
      title: "壹些提示",
    },
    component:()=>import('../views/Agreement.vue')
  },
  {
    path: '/friends/add',
    name: 'add',
    meta: {
      title: "和我成为朋友",
    },
    component:()=>import('../components/FriendComponents/FriendAdd.vue')
  },
  {
    path: '/category',
    name: 'word',
    meta: {
      title: "壹些文字",
    },
    component: () =>import('../views/Category.vue')
  },
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
